module(
    name = "rules_img_pull_tool",
    version = "0.2.10",
    compatibility_level = 1,
)

bazel_dep(name = "rules_img", version = "0.2.10")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "gazelle", version = "0.47.0")
bazel_dep(name = "rules_go", version = "0.59.0")

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")

# Known to exist since it is instantiated by rules_go itself.
use_repo(
    go_sdk,
    "go_host_compatible_sdk_label",
)

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(go_deps, "com_github_google_go_containerregistry")

pull_bootstrap = use_repo_rule("//pull/private:pull_bootstrap.bzl", "pull_bootstrap")

pull_bootstrap(
    name = "pull_bootstrap",
    go_mod = "//:go.mod",
    go_sum = "//:go.sum",
    pull_tool_srcs = ["//:pull_tool_srcs"],
)

# register the source bootstrapped pull_tool
pull_tool = use_extension("@rules_img//img/private/prebuilt:prebuilt.bzl", "pull_tool")
pull_tool.host_tool(binary = "@pull_bootstrap//:pull_tool.exe")
